package com.example.ecommercemarketing.controller;

import com.example.ecommercemarketing.entity.Product;
import com.example.ecommercemarketing.service.RecommendService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 推荐商品控制器
 */
@RestController
@RequestMapping("/api/recommend")
@Slf4j
public class RecommendController {

    private final RecommendService  recommendService;

    @Autowired
    public RecommendController(
            RecommendService  recommendService) {
        this.recommendService = recommendService;
    }

    /**
     * 获取推荐商品列表
     * <p>
     * URL示例：http://localhost:8080/api/recommend/merchant/products
     */
    @GetMapping("/merchant/products")
    public List<Product> getRecommendProductsByMerchant() {
        return recommendService.getRecommendProductsByMerchant();
    }
}